<!-- <template>
    <div class="announcement-container">
        <div v-for="(message, index) in messages" :key="index" class="message" v-slider
            @transitionend="handleTransitionEnd">
            <span style="color: #09B8A0;">[人事变更]</span>{{ messages }}
        </div>
    </div>
</template>

<script>
export default {
    data() {
        return {
            messages: '阿飞今天跑路了阿飞今天跑路了阿飞今天跑路了阿飞今天跑路了阿飞今天跑路了阿飞今天跑路了阿飞今天跑路了阿飞今天跑路了阿飞今天跑路了阿飞今天跑路了阿飞今天跑路了'
        };
    },
    directives: {
        slider: {
            inserted(el) {
                el.style.position = 'absolute';
                el.style.left = '110%';
                el.style.transition = 'left 16s linear';
                setTimeout(() => {
                    el.style.left = '-1912px';
                }, 0);
            },
        },
    },
    methods: {
        handleTransitionEnd(event) {
            event.target.style.display = 'none';
        },
    },
    mounted() {
        this.messages = JSON.parse(sessionStorage.getItem('公告信息')).content
    }
};
</script>

<style>
.announcement-container {
    overflow: hidden;
    width: 100%;
}

.message {
    color: #333333;
    width: 100%;
    height: 40px;
    line-height: 40px;
    font-size: 18px;
    position: absolute;
    top: 0;
}
</style>


 -->




<template>
    <div>
        <div class="message" v-slider>
            <span style="color: #09B8A0;">[{{ this.$store.state.noticecon.type }}]</span>{{
                this.$store.state.noticecon.con }}
        </div>
    </div>
</template>
  
<script>
export default {
    data() {
        return {
            notices: [
                { message: 'woshiohufhakhffahafhlafija' }
            ],
            animationStarted: false
        };
    },
    directives: {
        slider: {
            inserted(el) {
                el.style.float = "left";
                el.style.left = "110%";
                el.style.transition = "left 16s linear";
                setTimeout(() => {
                    el.style.left = "-4000px";
                }, 0);
            }
        }
    },
    methods: {
        handleTransitionEnd(event) {
            event.target.style.display = "none";
        },
        startAnimation() {
            if (!this.animationStarted) {
                this.animationStarted = true;
            }
        }
    },
    mounted() {
    }
};
</script>
  
<style>
.announcement-container {
    overflow: hidden;
    width: 100%;
}

.message {
    color: #333333;
    width: 4000px;
    height: 40px;
    line-height: 40px;
    font-size: 18px;
    position: absolute;
    top: 0;
}
</style>